1. Field of the Invention
The present invention relates to an image processing apparatus that detects an inclination of a document and an image processing method.
2. Description of the Related Art
When character recognition is performed or information embedded in a document is detected, it is necessary to perform processing for detecting an inclination of a document image. Conventionally, there has been a method as shown in FIG. 12 that is used as a method for detecting an inclination of an image. According to this method, a character rectangle is extracted from a character string of a document, and a feature point of each character rectangle (a centroid or a bottom left point or a bottom right point of a character rectangle) is calculated. Thereafter, a Hough transformation is performed on each feature point so that a straight line is calculated, and an inclination angle is detected from the straight line (for example, as described in Japanese Patent Laid-Open No. 03-213053).
However, with the conventional method for detecting an inclination, an inclination angle is detected based on a feature of each character and, thus, the following failures occur.
For example, as shown in FIG. 13, if a character string is constituted from characters having different sizes (or different centroids), since each character rectangle has a different size or is in a different position, the position of a feature point is different and thus an error in the inclination of a straight line occurs, possibly resulting in a decrease in an inclination detection accuracy.
Furthermore, as shown in FIG. 14, if noise appears on a character due to copying, scanning, or the like, the size of a character rectangle is detected to be different from the original size, and as a result, inclination detection accuracy may decrease.
When using the Hough transformation, points on one virtual straight line are counted, and if the number of the points exceeds a prescribed threshold, a straight line including those points is detected; thus, if points are randomly arranged, many straight lines are detected. For example, in the case of a document as shown in FIG. 15, since there are many points on a diagonal line as well, there may be false detection such as a case in which a diagonal line of the document is detected as a straight line considered to indicate an inclination of the document.